import Cookies from "js-cookie";

const TokenKey = "Electric-Ticket";

export function getToken() {
	return Cookies.get(TokenKey);
}

export function setToken(token) {
	return Cookies.set(TokenKey, token);
}

export function removeToken() {
	return Cookies.remove(TokenKey);
}

export function setLocalData(key, value) {
	if (!key || !value) return;
	localStorage.setItem(key, JSON.stringify(value));
}

export function getLocalData(key) {
	const localData = localStorage.getItem(key);
	if (!localData) return localData;
	return JSON.parse(localData);
}

export function removeLocalData(key) {
	localStorage.removeItem(key);
}

export function clearLocalData() {
	localStorage.clear();
}

// crypto-js
